package com.da.javatest.leetCode;

/**
 * @author chenlida
 * @date 2019/2/27 14:19
 * @description
 */
public class Code441 {
    public int arrangeCoins(int n) {
        int count = 0, i = 1;
        while (n > 0) {
            n -= i;
            i++;
            count++;
        }
        if (n < 0) {
            count--;
        }
        return count;
    }
}
